<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Ajax extends CI_Controller
{
	public function __construct()
	{
        parent::__construct();
		if(! is_ajax())
		{
			redirect(BASE_URL);
		}
		$member = $this->session->userdata('user');
		$this->memberid=$member['userid'];
		
    }
	public function index()
	{
		echo "hello";
	}
	public function send_mail($to,$subject,$message)
	{
		$settingdata=$this->general_model->select_val("setting","*","id = 1");
		/*$config=Array(
			"protocol"=>"smtp",
			"smtp_host"=>"ssl://smtp.gmail.com",
			"smtp_port"=>465,
			"smtp_user"=>"niranjannsahoo@gmail.com",
			"smtp_pass"=>"paikarapursibu"
		);
		$this->load->library('email',$config);*/
		$this->load->library('email');
		$this->email->set_mailtype("html");
		$this->email->set_newline("\r\n");
		$this->email->from($settingdata['notification_email'],$settingdata['site_name']);
		$this->email->reply_to($settingdata['notification_email'], $settingdata['site_name']);	
		$this->email->to($to);		
		$this->email->subject($subject);		
		$this->email->message($message);
		$this->email->send();
	}
	public function state($countryid) {
		
		$json = array();
			$json = array(
				'country_id'        => $countryid,
				'zone'           => $this->general_model->select("zone","*","country_id ='".$countryid."'")		
			);
		echo json_encode($json);
	}
	public function savesession()
	{
		$url=$_POST['url'];
		$this->session->set_userdata('url',$url);
        echo "saved";       
	}

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */